<template>
	<view>
		<u--form labelPosition="left" :model="addForm" :rules="rules" ref="uForm">
			<u-form-item label="名称" prop="name" borderBottom ref="item1">
				<u--input v-model="addForm.name"></u--input>
			</u-form-item>
			<u-form-item label="备注" prop="remark" borderBottom ref="item1">
				<u--input v-model="addForm.remark"></u--input>
			</u-form-item>
			<u-form-item label="数量" prop="num" borderBottom ref="item1">
				<u--input v-model="addForm.num" style=""></u--input>
			</u-form-item>
			<u-form-item label="商品主图" prop="pic" borderBottom ref="item1">
				<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
					:maxCount="10"></u-upload>
			</u-form-item>
		</u--form>
	</view>
</template>

<script>
	import {
		categoryTree
	} from '@/utils/api.js'
	export default {
		data() {
			return {
				rules: {
					'name': {
						type: 'string',
						required: true,
						message: '请填写名称',
						trigger: ['blur', 'change']
					}
				},
				addForm: {
					name: '',
					remark: '',
					num: '',
					pic: '',
				},
				fileList1: []
			};
		},
		mounted() {
			this.getcategoryTree()
		},
		methods: {
			afterRead(event) {
				console.log(event);
			},
			deletePic(event) {
				console.log(event);
			},
			getcategoryTree() {
				categoryTree({
					status: 1,
					type: 1
				}).then(res => {
					console.log(res);
				})
			}
		}
	}
</script>

<style lang="scss">

</style>